//
//  NextViewController.m
//  协议传值<带返回值.
//
//  Created by dllo on 16/8/4.
//  Copyright © 2016年 YMJ. All rights reserved.
//

#import "NextViewController.h"

@interface NextViewController ()
@property (nonatomic, strong) UILabel *label;
@end

@implementation NextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(200, 200, 200, 50);
    button.backgroundColor = [UIColor redColor];
    [button setTitle:@"那你怎么过好?" forState:0];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 400, 414, 50)];
    _label.backgroundColor = [UIColor redColor];
    _label.textColor = [UIColor blackColor];
    [self.view addSubview:_label];
    _label.text = @"我是nextVC";
    _label.text = [[self.delegate weHaveGoodTime:_label.text] stringByAppendingString:_label.text];
}
- (void)buttonAction:(UIButton *)btn {
    
    
    CATransition *animation = [CATransition animation];
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    animation.duration = 2;
    animation.type = kCATransitionPush;
    animation.subtype = kCATransitionFromBottom;
    [self.view.window.layer addAnimation:animation forKey:@"aa"];
    [self dismissViewControllerAnimated:NO completion:^{
        
        
    }];
    
}
- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
